package com.sdx.console.promote.service;

import java.util.List;

import org.beetl.sql.core.engine.PageQuery;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ibeetl.admin.core.util.PlatformException;

import com.sdx.console.promote.dao.TemplateShareDao;
import com.sdx.console.promote.entity.TemplateShare;
import com.ibeetl.admin.core.service.BaseService;

/**
 * 分享模板 Service
 */

@Service
@Transactional
public class TemplateShareService extends BaseService<TemplateShare>{

    @Resource
	private TemplateShareDao templateShareDao;

    public PageQuery<TemplateShare>queryByCondition(PageQuery query){
        PageQuery ret =  templateShareDao.queryByCondition(query);
        queryListAfter(ret.getList());
        return ret;
    }

    public void batchDelTemplateShare(List<String> ids){
        try {
            templateShareDao.batchDelTemplateShareByIds(ids);
        } catch (Exception e) {
            throw new PlatformException("批量删除分享模板失败", e);
        }
    }

	public List<TemplateShare> selectAll() {
		return templateShareDao.selectAll();
		}
}